package com.lianqi.emcpframework.core.bean;

import java.beans.PropertyDescriptor;

/**
 * @program emcp-framework
 * @ClassName BeanProperty
 * @description: bean属性操作类
 * @author: sky
 * @create: 2018/11/24 10:14
 */
public class BeanProperty extends Property{

    public BeanProperty(PropertyDescriptor descriptor){
        type = descriptor.getPropertyType();
        readMethodName = descriptor.getReadMethod().getName();
        writeMethodName = descriptor.getWriteMethod().getName();

        getter = getterFunction();
        setter = setterFunction(paramGetter -> writeMethodName +"("+paramGetter+")");
        name = descriptor.getName();
        beanType = descriptor.getReadMethod().getDeclaringClass();
    }
}
